<template>
	<view class="flex-col page">
	  <view class="flex-col space-y-24 group_3">
	    <view class="flex-col space-y-71 section_5">
	      <view class="flex-col space-y-31">
	        <view class="flex-row justify-between items-center">
	          <text class="font_3">历史记录</text>
	          <i class="iconfont icon-shanchu" @click="delAll"></i>
	        </view>
	        <view class="flex-row flex-wrap space-x-26">
	          <view class="flex-row space-x-24 section_6" v-for="(item,index) in recorders" :key="index">
	            <text class="font_4" @click="search(item)">{{item}}</text>
				<i class="iconfont icon-shanchu2" @click="delItem(index)"></i>
	          </view>
	        </view>
	      </view>
	      <view class="flex-col">
	        <text class="font_3 text_7">热门检索</text>
	        <view class="flex-row group_4 flex-wrap">
				<view class="flex-col items-center text-wrapper" v-for="(item,index) in hots" :key="index" @click="search(item)">
					<text class="font_4">{{item}}</text>
				</view>
	        </view>
			</view>
	    </view>
	  </view>
	</view>
</template>

<script>
	export default {
		props:['name'],
		data() {
			return {
				recorders:[],
				hots:['新能源','芯片','人工智能','环保设备','光伏','图像识别','激光']
			};
		},
		onLoad(option) {
			
		},
		created() {
			this.getRecorders();
		},
		methods:{
			getRecorders(){
				this.recorders = this.$store.getters.getSearchInfo;
			},
			search(value){
				this.$emit('sarchInfo',value)
			},
			delAll() {
				this.recorders = [];
				this.$store.commit('setSearchInfo',this.recorders)
			},
			delItem(index){
				this.recorders.splice(index,1);
				this.$store.commit('setSearchInfo',this.recorders)
			}
		}
	}
</script>

<style lang="scss" scoped>
.page {
  background-color: #f4f6f8;
  width: 100%;
  overflow-y: auto;
  overflow-x: hidden;
  height: 100%;
  .space-y-24 {
    & > view:not(:first-child),
    & > text:not(:first-child),
    & > image:not(:first-child) {
      margin-top: 24rpx;
    }
   .space-y-71 {
      & > view:not(:first-child),
      & > text:not(:first-child),
      & > image:not(:first-child) {
        margin-top: 71rpx;
      }
      .space-y-31 {
        & > view:not(:first-child),
        & > text:not(:first-child),
        & > image:not(:first-child) {
          margin-top: 31rpx;
        }
        .image_8 {
          margin-top: 4rpx;
          width: 24rpx;
          height: 25rpx;
        }
        .space-x-26 {
          & > view:not(:first-child),
          & > text:not(:first-child),
          & > image:not(:first-child) {
            margin-left: 26rpx;
          }
          .space-x-24 {
            & > view:not(:first-child),
            & > text:not(:first-child),
            & > image:not(:first-child) {
              margin-left: 24rpx;
            }
          }
          .section_6 {
			  margin-top: 16rpx;
            padding: 10rpx 12rpx 10rpx 22rpx;
            background-color: #f6f6f6;
            border-radius: 22rpx;
            height: 44rpx;
			display: flex;
			justify-content: space-around;
			align-items: center;
			i{
				margin-left: 20rpx;
			}
          }
        }
      }
      .font_3 {
        font-size: 30rpx;
        font-family: Microsoft YaHei;
        line-height: 29rpx;
        color: #666666;
      }
      .text_7 {
        align-self: flex-start;
      }
      .group_4 {
        margin-top: 31rpx;
        padding: 0 11rpx;
        .text-wrapper {
			margin-right: 20rpx;
			  margin-top: 16rpx;
          padding: 10rpx 0 11rpx;
          background-color: #f6f6f6;
          border-radius: 22rpx;
          width: 114rpx;
          height: 44rpx;
        }
      }
      .font_4 {
        font-size: 24rpx;
        font-family: Microsoft YaHei;
        line-height: 23rpx;
        font-weight: 300;
        color: #666666;
      }
      .group_5 {
        margin-top: 20rpx;
        padding: 0 12rpx;
      }
    }
    .section_5 {
      padding: 31rpx 29rpx 709rpx;
      background-color: #ffffff;
    }
  }
  .group_3 {
    padding-top: 29rpx;
    flex: 1 1 auto;
    overflow-y: auto;
  }
}
</style>